package cs422.group1.projectsquirrel;

import cs422.group1.projectsquirrel.ExtraSurvey.nextQuestionListener;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;


public class ExtraSurvey4 extends Activity
{
	//Instance variables.
	private Button nextButton;
	private EditText observationDetails;
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.extrasurveypage4);
		
		nextButton = (Button)findViewById(R.id.nextButton4);
		observationDetails = (EditText)findViewById(R.id.foodDescription);
		
		if (ObservationDataManager.isEdit())
			observationDetails.setText(ObservationDataManager.getData().feed_other_details);
		
        //Attaching a listener for callback on the next button.
        nextButton.setOnClickListener(new nextQuestionListener()); 
	}
	
	
	//Callback function for the NEXT button.
	public class nextQuestionListener implements OnClickListener
	{
		public void onClick(View view)
		{
			ObservationDataManager.getData().feed_other_details = observationDetails.getText().toString();
			nextPage();
		}
	}
		
	
	//Done with this activity, and moving on to the next one.
	private void nextPage()
	{
		Intent intent = new Intent(this.getBaseContext(),ExtraSurvey5.class);
		startActivity(intent);
	}

	
}
